package com.entrogy.utils;

import com.Sinewecology.SendMessage.WechatMsgDataBean;
import com.entrogy.bean.PassRecordEntity;
import org.apache.ibatis.annotations.Param;

import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.ConcurrentLinkedQueue;

/**
 * @author xlr
 * @description 队列---用来处理流水记录的
 * @date 2019-07-12
 */
public class QueueUtils {

    private static ConcurrentLinkedQueue<PassRecordEntity> linkedQueue = new ConcurrentLinkedQueue<PassRecordEntity>();

    //入队列
    public static boolean offerQueue(PassRecordEntity passRecordEntity) {
        linkedQueue.offer(passRecordEntity);
        return true;
    }

    //出队列
    public static PassRecordEntity pollQueue() {
        if (!linkedQueue.isEmpty()) {
            PassRecordEntity passRecordEntity = linkedQueue.poll();
            return passRecordEntity;
        } else
            return null;
    }
}
